<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
	<title>Compiling Nairn_MPM-FEA Code</title>
	<link rel="stylesheet" type="text/css" href="../help.css">
</head>
<body>

<p class="links">
<a href="../index.html">Home</a> &rarr;
Getting Started
</p>

<h1><a name="top"></a>Compiling NairnMPM and NairnFEA Source Code</h1>

<p>After checking out the <code>nairn-mpm-fea</code> project, the next step is to compile it. Detailed instructions for compiling the code engines is available in the <a href="http://osupdocs.forestry.oregonstate.edu/index.php/Compile_the_Code_Engines">OSUPDocs wiki</a>. This section only describes command line compilation.</p>

<p>The code can easily be compiled on any Unix or Linux system with a c++ compiler and with open-source 
<a href="http://xml.apache.org/xerces-c/index.html"><code>xerces</code></a> library for reading <code>XML</code> input files already installed. To compile <code>NairnMPM</code> navigate to its build folder and use the <code>make</code> command:</p>

<pre>
cd nairn-mpm-fea/NairnMPM/build
make SYSTEM=(system)
</pre>

<p>or compile <code>NairnFEA</code> navigate to its build folder and use the <code>make</code> command:</p>

<pre>
cd nairn-mpm-fea/NairnFEA/build
make SYSTEM=(system)
</pre>

<p>where <code>(system)</code> is one of the systems supported for easy compilation. To learn about the available systems, you can consult comments in the <code>makefile</code> in each project in their build folders. These commands will compile all source code and install the executables in <code>nairn-mpm-fea/NairnMPM/input</code> or <code>nairn-mpm-fea/NairnFEA/input</code>, respectively.

<p>Compiling on any other Linux/Unix system should be straightforward, with the most difficult step usually being installing and linking to the <a href="http://xml.apache.org/xerces-c/index.html"><code>xerces</code></a> library. The key steps needed for successful compilation:</p>

<ol>
<li>Use a compatible <code>C++</code> compiler. The code has been tested up to <code>gcc 7.x</code> and <code>clang-mp 7</code>. Note that <code>gcc 4.8</code> is minimum if you are compiling for parallel execution. It is possible other compilers will need minor changes for compilation, but most should work.</li>

<li>Compiling of <code>NairnMPM</code> or <code>NairnFEA</code> needs access to all the <code>xerces</code> header files. These are provided in the <code>xerces</code> source code download. Even if your system has the xerces binary installed, it may not have the header files. You can get them by  <a href="http://xml.apache.org/dist/xerces-c/stable/">downloading the xerces source code</a>, even though you will not need to build it.</li>

</ol>

<p>Once a suitable compiler, the <code>xerces</code> binary, and <code>xerces</code> header files are installed, compilation may require editing the <code>makefile</code>s in the <code>nairn-mpm-fea</code> folders. Specifically, you will need to edit the <code>makefile</code>s in the <code>build</code> directories (<code>NairnMPM</code> and <code>NairnFEA</code>) and set the following variables:</p>

<ol>
<li>The variable <code>CC</code>: set it to the desired <code>C++</code> compiler.</li>
<li>The variable <code>xercesSo</code>: set it to the path name to the <code>xerces</code> library binary file.</li>
<li>The variable <code>headersPath</code>: set it to the path name to the folder containing the <code>xercesc</code> folder of header files.</li>
<li>See other possible variables in the comments of the <code>makefile</code> for each project.</li>
</ol>


<p class="links">
<a href="../index.html">Home</a> &rarr;
Getting Started
</p>

</body>
</html>
